from django.shortcuts import render

from django.shortcuts import HttpResponse

# Create your views here.

def index(request):
    #request.GET
    #request.POST

    #return HttpResponse("hello world")

    userlist = [
        {"user": "jack", "pwd": "abc"},
        {"user": "tom", "pwd": "ABC"},
    ]

    if request.method == 'POST':
        username = request.POST.get("username", None)
        password = request.POST.get("password", None)

        temp = {"user": username, "pwd": password}
        userlist.append(temp)
        print (userlist)
        #print(username, password)

    return render(request, "index.html", {"data": userlist})